using UnityEngine;
using System.Collections;

public class PlayerScript : MonoBehaviour {
	
	public float x;
	private float y;
	public float speed;

	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
		
		x = Input.GetAxis("Horizontal")*Time.deltaTime*speed;
		
		transform.Translate(x, 0, 0);
		
		if (rigidbody.useGravity==false){
			y = Input.GetAxis("Vertical")*Time.deltaTime*speed;
		
		transform.Translate(x, y, 0);
		}
		
		if(Input.GetKeyDown("space") && rigidbody.useGravity==true){
			rigidbody.useGravity=false;
		}
		else if(Input.GetKeyDown("space") && rigidbody.useGravity==false){
			rigidbody.useGravity=true;
		}
	
	}
}
